﻿using System;
using System.Linq.Expressions;
using NHibernate.Expression.Extensions.Helpers;
using NHibernate.Criterion;

namespace NHibernate.Expression.Extensions {
	public static class PropertyExtensions {
		public static AbstractCriterion Between<T>(this Property self, T min, T max) {
			return self.Between(min, max);
		}

		public static AbstractCriterion EqProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.EqProperty(other.MemberName());
		}

		public static AbstractCriterion NotEqProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.NotEqProperty(other.MemberName());
		}

		public static AbstractCriterion GeProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.GeProperty(other.MemberName());
		}

		public static AbstractCriterion LeProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.LeProperty(other.MemberName());
		}

		public static AbstractCriterion GtProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.GtProperty(other.MemberName());
		}

		public static AbstractCriterion LtProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.LtProperty(other.MemberName());
		}

		public static Property GetProperty<T>(this Property self, Expression<Func<T, object>> other) {
			return self.GetProperty(other.MemberName());
		}
	}
}